.----------------------------------------------------------------. | FRMPRT - Form Printing Utility - Rev 1.0 | |----------------------------------------------------------------| | By: Bob Kochem | Tel: (617)489-5639 | | Addr: Minuteman Systems | Compuserve: 74252,2350 | | P.O.Box 152 | Internet: bck@world.std.com | | Belmont, MA 02178 | Date : 15-Nov-94 | `----------------------------------------------------------------' Description: FRMPRT is a utility for use with Visual BASIC. When called, it transfers the Controls (labels, text boxes, grids, etc) on a specified Form to the Printer Object, for printing. Files Supplied: FRMPRT.MAK - Overall MAK File FRMPRT.FRM - A Demo Form to call the FRMPRT utility FRMPRT.BAS - The several Procedures, and declarations, that make up FRMPRT All supplied files are in TEXT format. This utility was developed in Visual Basic 3.0, Professional Addition. However, it is generic enough that the TEXT files may be ported to the Standard or Professional Editions of rev 2.0 or 3.0 of Visual Basic. Copyright Notice: This utility and all associated files are Copyrighted in 1994 by Minuteman Systems of Belmont Massachusetts. Liability : Minuteman Systems will assume no liability for any losses arising from use of this utility. Operating The Demonstration Program ----------------------------------- Load the supplied files into a directory on your computer's hard drive. Call up Visual Basic and load the program (VB 2.0 users may have to do this via a Load Text operation. Some additional editing of files may be needed.) View the form FORM1. There are two command buttons RUN and EXIT. These must be left alone. There are a number of other controls on the form for sample purposes. The sample forms may be edited or deleted, and other controls may be added. When the Program is run, FORM1 will appear. Clicking the RUN command button will cause all controls on FORM1 to be sent to your system's designated printer. Clicking EXIT will terminate execution. Uses Of FRMPRT --------------- FRMPRT is useful in (at least) 2 scenarios 1. If you have a program that requires doing a printed output of one or more forms, a call to FRMPRT is an easy way to generate a printed output. It offers advantages over using the form.print method. Form.print generates a bit-mapped output with poor resolution and takes a long time to execute. 2. FRMPRT can be used as a generic tool to siplify creation of output reports even if they aren't related to any displayed forms. Create one or more forms representative of the size and orientation of your printed output page(s). This form need never be "SHOWN" during program execution. Place text boxes, labels, etc. on the forms using visual techniques to "layout" your printed output. At program execution set the text boxes, grids, or other controls to the desired output values. FRMPRT can be called to transfer the forms to the printer object and then to the printer. Some Details & Notes on FRMPRT operation ----------------------------------------- 1. FRMPRT is a procedure with one argument - the name of the Form to be copied to the printer object. Examine the demo program/form and you will see that the RUN command button just passes the name FORM1 to FRMPRT. Presently a call to the printer via the CommonDialog Box is included in the FRMPRT routine. You may wish to move that out of the routine. Depending upon your version of Visual Basic, you may wish to or need to comment out and/or delete the CommonDialog box. 2. Controls Supported FORM PRT presently handles the following controls; Text Boxes Command Buttons Labels Grids CheckBoxes Option Buttons Both the "normal" and "3d" versions of controls are supported. If your version of VB does not support the 3d controls or any other controls, the offending lines may be commented out. 3. "Contained" Controls FRMPRT works well with controls even if they are "contained" within Frames or other containers. However, they may be only nested 1-deep. I.E. controls within Frames within Frames will not be handled properly. 4. Printer Limitations FRMPRT attempts to use the same FontStyle and related font parameters on the printer as are used for each control on the Form. If the Printer does not support a font or font parameter, Windows may make a "close" substitution, or the program may even cause an error. One particularly vexing problem is that different versions of Windows handle the fonts MS Sans Serif and MS Serif in a ... unique... manner. Unfortunately on many systems these fonts also happen to be screen defaults. FRMPRT attempts to discover this problem by error trapping and substituting the more universal font COURIER. (You may wish to modify this part of the code or make it more robust as appropriate for your application.)